package com.ruoyi.shanghu.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.shanghu.domain.SysUser;
import com.ruoyi.shanghu.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("/business")
public class SysUserController extends BaseController {

    @Autowired
    SysUserService userService;

    /**
     * 查询商户列表
     */
    @GetMapping("/list")
    public TableDataInfo list(SysUser sysUser) {
        startPage ( );
        List<SysUser> list = userService.selectSysUserList ( sysUser );
        return getDataTable ( list );
    }

    /**
     * 获取商户详细信息
     */
    @GetMapping("getById")
    public AjaxResult getById(Long id) {
        System.out.println (id+"id" );
        SysUser byId = userService.getById ( id );
        System.out.println (byId+"byId" );
        return success ( byId);
    }

    /**
     * 审核商户
     */
    @PutMapping
    public AjaxResult edit(@RequestBody SysUser sysUser) {
        System.out.println ("sysUser" + sysUser);
        return toAjax ( userService.updateSysUser ( sysUser ) );
    }


}
